#include"Keyboard.h"

Keyboard::Keyboard( EventBoard* eb ) {
   board = eb;
   binds=0;
}

void Keyboard::bind(int event, int message)
{
   bind_list[binds].event = event;
   bind_list[binds++].message = message;
}

//el message = 0 esta proibido
void Keyboard::check()
{
   int event = getEvent();
   //if (key==ERR) return;

   //busco si la tecla esta asignada a algun comando
   for(int i=0;i<binds;i++)
   {
      if (bind_list[i].event==event)
      {
	 board->Post(bind_list[i].message);
	 break;
      }
   }
}

int Keyboard::init (void* data) { return 0; }
void Keyboard::done () { }
int Keyboard::getEvent () { return 0; }
